--创建病床表序列
create sequence seq_sickbed;

--创建病床表
create table sickbed
(

    id                   number(8) primary key,--序列，主键

    sickbed_num          nvarchar2(50) default 'sickbed_' || substr(sys_guid(), 1, 12) not null unique,--病床编号，非空，唯一，默认表名_uuid()前12位。

    ward_id              number(8),--病房id。

    is_enable            number(1)     default 1, -- 是否可用，0：不可用，1：可用 , 默认1

    create_date          date          default sysdate, -- 创建时间

    create_username      nvarchar2(50), -- 创建用户名称

    last_update_date     date, -- 最后一次修改时间

    last_update_username nvarchar2(50), -- 最后一次修改用户名称

    delete_date          date -- 删除时间

-- constraint fk_ward_id foreign key (ward_id) references ward (id)--外键约束（ward_id）
);

insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 8);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 9);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 10);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 11);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 12);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 13);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 14);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 15);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 16);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 17);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 18);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 19);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 20);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 21);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 22);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 23);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 24);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 25);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 26);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 27);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 28);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 29);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 30);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 31);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 32);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 33);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 34);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 35);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 36);

insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 8);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 9);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 10);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 11);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 12);

insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 8);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 9);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 10);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 11);
insert into sickbed(id, ward_id)
values (seq_sickbed.nextval, 12);



select *
from sickbed;


commit;
